Repository navigation
fix(id-web): validate ordered_list start in parseDOM (#2005) - #4078
Merged
Merged
Conversation
Replace the bare Number() on the <ol start> attribute with parseOrderedListStart: only a plain non-negative decimal integer within safe-integer range is preserved (0 included); malformed, fractional, negative, hex/scientific, empty, or unsafe values fall back to 1 instead of being reinterpreted, so pasted lists no longer silently renumber on save through the u64 markdown codec. Tests: unit + parseDOM getAttrs cases for abc, 2.5, 0x10, 1e3, empty, -3, 9007199254740993 (fallback 1) and 5, 0, 42 (preserved); editor suite 85/85 pass on the laptop.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
5 tasks
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2005 (task 5069).
Problem
ordered_listparseDOM read the<ol start>attribute with bareNumber(), so pasted HTML could produceordervalues the markdown codec cannot represent (it reads order asu64):abc→ NaN,2.5→ fraction,0x10→ 16, empty → 0,-3→ negative. On save those silently renumbered the list from 1.Change
pkgs/id/web/src/editor.ts: new exportedparseOrderedListStart— preserves only a plain non-negative decimal integer within safe-integer range (0 included); malformed, fractional, negative, hex/scientific, empty, or unsafe values fall back to 1 with no reinterpretation. parseDOM now uses it.Tests
pkgs/id/web/src/editor.test.ts: unit + parseDOMgetAttrscases —abc,2.5,0x10,1e3, empty,-3,9007199254740993→ 1;5,0,42→ preserved; absent attribute → 1.bunx vitest run src/editor.test.ts— 85/85 pass.bunx tsc --noEmitshows exactly 1 error before and after this change, pre-existing insrc/image-upload.test.ts(unrelated file).🤖 Queue worker (repo-worker-code), task 5069.
Need help on this PR? Tag
@codesmith-botwith what you need.